package com.ruibang.glass.material.controller;

import com.ruibang.glass.material.domain.req.MaterialInAndOutRecordReq;
import com.ruibang.glass.material.domain.req.MaterialRecordsReq;
import com.ruibang.glass.material.domain.req.ycl.MaterialInventoryReq;
import com.ruibang.glass.material.service.GMaterialAllOutboundManagementService;
import com.ruibang.glass.material.service.MaterialInAndOutRecordsService;
import com.ruibang.glass.material.service.impl.GMaterialALLInventoryManagementServiceImpl;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 出入库流水
 * </p>
 *
 * @author mameng
 * @since 2024-04-28
 */
@RestController
@RequestMapping("/api/material/in/and/out/records")
@Api(value = "出入库流水", tags = {"出入库流水"})
public class InAndOutInventoryRecordsController {
    @Autowired
    private MaterialInAndOutRecordsService materialInAndOutRecordsService;

    @PostMapping("/list")
    @ApiOperation(value = "全模块出入库流水", response = ResultBody.class)
    public ResultBody getPageList(@RequestBody MaterialInAndOutRecordReq materialInAndOutRecordReq) {
        return ResultBody.success(materialInAndOutRecordsService.getPage(materialInAndOutRecordReq));
    }

    @PostMapping("/cpList")
    @ApiOperation(value = "成品流水", response = ResultBody.class)
    public ResultBody CpList(@RequestBody MaterialInAndOutRecordReq materialInAndOutRecordReq) {
        return ResultBody.success(materialInAndOutRecordsService.getCPPageList(materialInAndOutRecordReq));
    }

    @PostMapping("/bcpList")
    @ApiOperation(value = "半成品流水", response = ResultBody.class)
    public ResultBody bcpList(@RequestBody MaterialInAndOutRecordReq materialInAndOutRecordReq) {
        return ResultBody.success(materialInAndOutRecordsService.getBCPPageList(materialInAndOutRecordReq));
    }

    @PostMapping("/rqList")
    @ApiOperation(value = "容器流水", response = ResultBody.class)
    public ResultBody rqList(@RequestBody MaterialRecordsReq materialRecordsReq) {
        return ResultBody.success(materialInAndOutRecordsService.getRQPageList(materialRecordsReq));
    }


    @GetMapping("/rqGetOneByNumber/{number}")
    @ApiOperation(value = "容器详情查看", response = ResultBody.class)
    public ResultBody rqList(@PathVariable("number")String number) {
        return ResultBody.success(materialInAndOutRecordsService.rqGetOneByNumber(number));
    }

}
